<?php

use App\Http\Controllers\AdminController;
use App\Http\Controllers\ExpertController;
use App\Http\Controllers\FrontController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VideoController;
use App\Models\Video;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/login',[UserController::class,'login'])->name('login');
Route::post('/login',[UserController::class,'doLogin']);
Route::get('/logout',[UserController::class,'logout'])->middleware('auth');

Route::get('/adm',[AdminController::class,'admin'])->middleware('auth');
Route::prefix('adm')->middleware('auth')->group(function (){
    Route::resource('user',UserController::class)->middleware('auth');//后台用户列表页
    Route::resource('expert',ExpertController::class)->middleware('auth');//专家用户列表页
    Route::resource('video',VideoController::class,)->middleware('auth');//后台新增管理员
    Route::post('/video/{id}',[VideoController::class,'update']);
//    Route::get('/add-user',[UserController::class,'create']);//后台新增管理员
//    Route::post('user/add-user',[UserController::class,'store']);//后台新增用户处理逻辑页
//    Route::get('/user/edit-user/{id}',[UserController::class,'edit']);//后台更改密码
//    Route::post('user/edit-user/{id}',[UserController::class,'update']);//后台更改密码逻辑处理
//
//    Route::get('/expert/add-expert',[ExpertController::class,'create']);//后台新增管理员
//    Route::post('expert/add-expert',[ExpertController::class,'store']);//后台新增用户处理逻辑页
//    Route::get('/expert/edit-expert/{id}',[ExpertController::class,'edit']);//后台更改密码
//    Route::post('expert/edit-expert/{id}',[ExpertController::class,'update']);//后台更改密码逻辑处理
//
//    Route::get('/video/add-video',[VideoController::class,'create']);//后台新增管理员
//    Route::post('video/add-video',[VideoController::class,'store']);//后台新增用户处理逻辑页
//    Route::get('/video/edit-video/{id}',[VideoController::class,'edit']);//后台更改密码
//    Route::post('video/edit-video/{id}',[VideoController::class,'update']);//后台更改密码逻辑处理


});
Route::get('/',[FrontController::class,'index']);
Route::get('/class',[FrontController::class,'class']);
Route::get('/expert',[FrontController::class,'expert']);
Route::get('/video',[FrontController::class,'video']);
Route::get('/expert/info/{id}',[FrontController::class,'expertShow']);
Route::get('/video/info/{id}',[FrontController::class,'videoShow']);



//
//Route::get('/test',function (){
//    $result=Video::where('id','3')->delete();
//    echo "done";
//});
